Skip to content

fix: honor ISO 8601 offsets when deserializing dates - #443

Open
pcbeingused333 wants to merge 1 commit into
crowdin:masterfrom
pcbeingused333:fix/c3664-date-offset
Open

pcbeingused333 wants to merge 1 commit into
crowdin:masterfrom
pcbeingused333:fix/c3664-date-offset

Conversation

@pcbeingused333

Copy link
Copy Markdown

ISO 8601 timestamps with an explicit offset are currently parsed with a format that stops before the offset. Consequently, the same API response produces different instants depending on the JVM's default time zone. For example, 2019-07-11T07:40:22+00:00 becomes 2019-07-11T11:40:22Z in America/New_York.

Parse offset-bearing ISO timestamps with Java 8's OffsetDateTime and convert the resulting instant to Date. Keep the existing parsing paths for legacy timestamps without a zone. This also preserves fractional seconds in ISO timestamps.

Regression tests exercise the registered Jackson deserializer under a non-UTC default time zone, covering zero, positive and negative offsets, Z, fractional seconds, and legacy and empty values. The original default zone is restored after each test.

Validation: ./gradlew --offline --no-daemon build passes all 894 tests on JDK 8 with Gradle 7.6.4. The regression test fails on the original implementation (1 failure out of 2 tests) and passes with the fix (2 tests).

AI assistance was used to prepare this change and its tests.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant